package com.xbongbong.sys.model.impl;

import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.sys.domain.dao.RegisteredCallBackDao;
import com.xbongbong.sys.domain.entity.RegisteredCallBackEntity;
import com.xbongbong.sys.model.RegisteredCallBackModel;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * RegisteredCallBackModel 实现
 * @author kaka
 * @date 2019/3/28 21:01
 * @since v1.0
 * @version v1.0
 */
@Service("registeredCallBackModel")
public class RegisteredCallBackModelImpl implements RegisteredCallBackModel {

    @Resource
    private RegisteredCallBackDao registeredCallBackDao;

    @Override
    public Integer save(RegisteredCallBackEntity entity) {
        if(entity.getId() == null || Objects.equals(0, entity.getId())) {
            return registeredCallBackDao.insert(entity);
        }
        return registeredCallBackDao.update(entity);
    }

    @Override
    public Integer deleteByKey(String key) {
        return null;
    }

    @Override
    public RegisteredCallBackEntity getByKey(String key) {
        return registeredCallBackDao.getByKey(key);
    }

    @Override
    public Integer insert(RegisteredCallBackEntity entity) throws XbbException {
        return registeredCallBackDao.insert(entity);
    }

    @Override
    public Integer update(RegisteredCallBackEntity entity) throws XbbException {
        return registeredCallBackDao.update(entity);
    }

    @Override
    public List findEntitys(Map<String, Object> param) {
        return registeredCallBackDao.findEntitys(param);
    }

    @Override
    public Integer getEntitysCount(Map<String, Object> param) {
        return registeredCallBackDao.getEntitysCount(param);
    }

    @Override
    public List findEntitysWithoutSub(Map<String, Object> param) {
        return null;
    }
}
